<?php
/**
 * Created by PhpStorm.
 * User: 67164
 * Date: 2016/8/13
 * Time: 0:15
 */

/**
 * 格式化邮件字符串
 * @param $receiver     收件人
 * @param $subject      标题
 * @param $body         内容
 * @param $money        金币
 * @param $item_id      道具编号
 * @param $item_count   道具数量
 * @return string
 */
function formatMail($receiver, $subject, $body, $money, $item_id, $item_count) {
    $mailData = array(
        'receiver'      => $receiver,
        'subject'       => $subject,
        'body'          => $body,
        'money'         => $money,
    );
    if ($item_id != 0) {
        $mailData['items'] = array(
            array( 'id' => $item_id, 'count' => $item_count )
        );
    }
    return json_encode($mailData, JSON_UNESCAPED_UNICODE);
}